<?php

$name = getInputArray("name", $params,'');
$validate = getInputArray("validate", $params,'');
$id = getInputArray("id", $params,str_replace(".","",str_replace(" ","",microtime())));
$required = getInputArray("required", $params,false);
$text = langEcho("password");

$requiredString = "false";
if($required){
	$requiredString = "true";
}

$labelid = str_replace(".","",str_replace(" ","",microtime()));
$labelIdRepeat = str_replace(".","",str_replace(" ","",microtime()));
$messageRequired = getInputArray("messageRepeat", $params,langEcho("messageRequired"));
$messageRepeat = getInputArray("messageRepeat", $params,langEcho("messagerepeat"));
$class = getInputArray("class", $params, '');

?>
 
<?php
echo "<div class='passwordContainer'>";
echo "<div class='firstPassword rounded'>";
echo "<input type='password' "; 
if ($name != "") echo " name='" . $name ."' ";
 
if ($id != "") echo " id='" . $id ."' ";

if ($class != "") echo " class='" . $class ."' ";

$onfocus = "";
$onblur = "";
if($text != ''){
	$onfocus .= "cleanValue('$id','$text');";
	$onblur .= "setValue('$id','$text');";
}

if($onfocus != ''){
	echo " onfocus=\"$onfocus\" ";
}

$onblur .= " validate_string(this.value, " . $requiredString . ", '" . $labelid . "','".$messageRequired."', '".$text."');"; 
if($onblur != ''){
	echo "onblur=\"$onblur\"";
}

if ($text != "") echo " value='" . $text ."' ";


echo "/><span class='validateTextbox' id='".$labelid."' ></span>";
echo "</div>";
echo "</div>";



$idRepeat = $id . "Repeat";
$nameRepeat = $name . "Repeat";


echo "<div class='passwordContainer'>";
echo "<div class='secondPassword rounded'>";
echo "<input type='password' "; 
if ($nameRepeat != "") echo " name='" . $nameRepeat ."' ";
 
if ($idRepeat != "") echo " id='" . $idRepeat ."' ";

if ($class != "") echo " class='" . $class ."' ";

$onfocus = "";
$onblur = "";
if($text != ''){
	$onfocus .= "cleanValue('$idRepeat','$text');";
	$onblur .= "setValue('$idRepeat','$text');";
}

if($onfocus != ''){
	echo " onfocus=\"$onfocus\" ";
}

$onblur .= " validate_string(this.value, " . $requiredString . ", '" . $labelIdRepeat . "','".$messageRequired."', '".$text."');"; 
if($onblur != ''){
	echo "onblur=\"$onblur\"";
}

if ($text != "") echo " value='" . $text ."' ";


echo "/><span class='validateTextbox' id='".$labelIdRepeat."' ></span>";
echo "</div>";
echo "</div>";


if($validate != ''){
echo '<script type="text/javascript">';
echo "registerValidation('$validate', '$id',$requiredString, 'string', '$labelid', '$messageRequired', '', '$text');";
echo "registerValidation('$validate', '$idRepeat',$requiredString, 'string', '$labelIdRepeat', '$messageRequired', '', '$text');";
echo "registerValidationPassword('$validate', '$id', '$idRepeat', 'password', '$labelIdRepeat', '$messageRepeat');";

echo '</script>';
}
?>